﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DataBaseTable;

public partial class M_NewWishNote : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Master.WebSubTitle += "许愿-";
            //zhuantiID_hf.Value = Request.QueryString["id"];
            zhuantiID_hf.Value = "6";
            this.initDropDownList();
        }

    }
    private void initDropDownList()
    {
        DataSet ds = new DataSet();
        ds.ReadXml(Server.MapPath(@"~/XML/BlessingType.xml"));
        lei_ddl.DataSource = ds;
        lei_ddl.DataTextField = "value";
        lei_ddl.DataValueField = "id";
        lei_ddl.DataBind();
    }
    protected void submit_btn_Click(object sender, EventArgs e)
    {
        WishingWallTable wwt = new WishingWallTable();
        wwt.qname = Request.Form["name_tb"];
        wwt.qtname = Request.Form["toname_tb"];
        wwt.qqq =Request.Form["qq_tb"] ;
        wwt.qlei = lei_ddl.SelectedValue;
        wwt.qgame = Request.Form["game_tb"];
        wwt.qip = GetClientIP.get();
        wwt.qshenhe = 1;
        wwt.ztID = Convert.ToInt32(zhuantiID_hf.Value);
        wwt.userAgen = "mobile";
        try
        {
            wwt.Insert();
            ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('您许愿成功!!\\n首先谢谢您来到这里留下您的祝福!\\n我在这里祝您以后心想事成,愿望成真!!');window.location.href='WishingWall.aspx'</script>");
        }
        catch
        {
            ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('抱歉由于系统原因,发送失败');</script>");
        }
    }
}